<template>
	<view class="scan-container">
		<view class="scan-frame" @click="toWriteOff">
			<view class="scan-border top"></view>
			<view class="scan-border right"></view>
			<view class="scan-border bottom"></view>
			<view class="scan-border left"></view>
			<view class="scan-line"></view>
		</view>
	</view>
</template>

<script setup>
	import {
		ref
	} from 'vue'
	const toWriteOff = () => {
		uni.navigateTo({
			url: '/pages/index/scanCode/writeOff/writeOff'
		})
	}
</script>

<style scoped>
	.scan-container {
		flex: 1;
		display: flex;
		justify-content: center;
		align-items: center;
		background-color: #000;
		height: 100vh;
	}

	.scan-frame {
		width: 300rpx;
		height: 300rpx;
		position: relative;
		border: 5rpx solid #fff;
	}

	.scan-border {
		position: absolute;
		width: 50rpx;
		height: 50rpx;
		background-color: #fff;
	}

	.top {
		top: -5rpx;
		left: -5rpx;
	}

	.right {
		top: -5rpx;
		right: -5rpx;
	}

	.bottom {
		bottom: -5rpx;
		right: -5rpx;
	}

	.left {
		bottom: -5rpx;
		left: -5rpx;
	}

	.scan-line {
		width: calc(100% - 10rpx);
		height: 5rpx;
		background-color: #fff;
		position: absolute;
		top: 50%;
		left: 5rpx;
		animation: scanAnimation 2s linear infinite;
	}

	@keyframes scanAnimation {
		0% {
			top: 5rpx;
		}

		100% {
			top: calc(100% - 5rpx);
		}
	}
</style>